<div class="col-lg-12">
    <div>
        <div class="card col-md-12">
            <div class="card-header">
                <h4 style="font-size: 20px"><a class='mdi mdi-arrow-left-thick left'
                                               style='cursor: pointer;padding: 0 10px 0 0' title='返回'
                                               onclick="(search_word===null)?home_page(this_page):search_product_page(search_word,this_page)"></a>商品详情</h4>
            </div>
            <div class="row" style="margin: 0 0 40px 0">
                <div class="card-body">
                    <div class="col-md-6 text-center">
                        <div class="form-group">
                            <div><img id="img-display" src="" alt="" style="width: 220px;height: 220px"></div>
                        </div>
                    </div>
                    <div class="col-md-6 text-center">
                        <div class="form-group" style="padding: 0 10px 5px 10px">
                            <label style="font-size: 20px">商品标题</label>
                            <div id="title-display"></div>
                        </div>
                        <div class="form-group" style="padding: 5px 10px">
                            <label style="font-size: 20px">商品价格</label>
                            <div id="price-display"></div>
                        </div>
                        <div class="form-group" style="padding: 5px 10px 0 10px">
                            <label style="font-size: 20px">商品评分</label>
                            <div id="star-display"></div>
                        </div>
                        <div>
                            <button class="btn btn-primary" onclick='product_buyer_cart_add(product_id)'>
                                <span class="mdi mdi-cart-plus"></span>加入购物车</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var response = product_buyer_detail(product_id);
    if (response === null) {
        alert_to_user("无对应商品信息，请检查操作是否正确");
        $("main").load("element/product-list.html");
    }
    document.getElementById("img-display").src = response.filePath;
    document.getElementById("title-display").innerHTML = response.title;
    document.getElementById("price-display").innerHTML = "￥" + response.price.toFixed(2);
    document.getElementById("star-display").innerHTML = (response.star !== null ? response.star.toFixed(2) : "暂无评分");
</script>